﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.System.UserProfile;
using App1.DataModel;
using App1.Exceptions;

namespace App1.Map
{
    public class MapController
    {

        private String userName;
        public String UserName
        {
            get { return this.userName; }
            set { this.userName = value; }
        }

        public MapController()
        {
            this.IdentifyUser();
        }

        private async void IdentifyUser()
        {
            String name = await UserInformation.GetDisplayNameAsync();
            if (string.IsNullOrEmpty(name))
            {
                throw new LoginRequiredException("User must be logged with a passport account");
            }
            else
            {
                this.UserName = name;
            }
        }

        public String MapTitle
        {
            get { return ("Events near " + this.UserName) ; }
        }
    }
}
